package cn.alex.sso.project.sync.module;

import cn.alex.sso.project.sync.entity.DataSyncEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Alex
 * @date 2024/12/1 03:31
 */
@Component
public class UserDataSyncModule implements DataSyncModule {
    public static final DataSyncEntity MODULE = new DataSyncEntity("用户管理", "user");

    @Override
    public DataSyncEntity getModule() {
        return MODULE;
    }

    @Override
    public List<DataSyncEntity> getTriggerList() {
        return Arrays.stream(DeptDataSyncModule.Trigger.values()).map(trigger -> new DataSyncEntity(trigger.getName(), trigger.getValue())).collect(Collectors.toList());
    }

    @Getter
    @AllArgsConstructor
    public enum Trigger {

        /**
         * 数据同步类型
         */
        ADD("新增", "add"),
        EDIT("修改", "edit"),
        DELETE("删除", "delete"),
        EDIT_STATUS("修改状态", "edit_status");

        private final String name;
        private final String value;
    }
}
